package cn.ranko.shiro.service;

import cn.ranko.shiro.mapper.SysUserRoleMapper;
import cn.ranko.shiro.model.SysUserRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * Created by zhujun on 2017/9/11.
 */
@Service
public class SysUserRoleService {

    @Autowired
    SysUserRoleMapper sysUserRoleMapper;

    public Set getSet(Integer userId) {
        List<SysUserRole> userRoleList = sysUserRoleMapper.getSysUserRoleByUserId(userId);

        Set set = new HashSet();
        for(SysUserRole userRole : userRoleList){
            set.add(userRole.getRoleId());
        }

        return set;
    }
}
